import { IPSAppPortletCat } from './ipsapp-portlet-cat';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysCss } from '../../res/ipssys-css';
import { IPSSysImage } from '../../res/ipssys-image';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppPortletCatImpl extends PSModelObjectImpl implements IPSAppPortletCat {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected namepslanguageres: IPSLanguageRes | null = null;

  getNamePSLanguageRes(): IPSLanguageRes | null {
    if (this.namepslanguageres != null) return this.namepslanguageres;
    const value = this.M.getNamePSLanguageRes;
    if (value == null) {
      return null;
    }
    this.namepslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getNamePSLanguageRes') as IPSLanguageRes;
    return this.namepslanguageres;
  }

  get namePSLanguageRes(): IPSLanguageRes | null {
    return this.getNamePSLanguageRes();
  }

  getNamePSLanguageResMust(): IPSLanguageRes {
    const value = this.getNamePSLanguageRes();
    if (value == null) {
      throw new Error('未指定名称语言资源');
    }
    return value;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  protected pssyscss: IPSSysCss | null = null;

  getPSSysCss(): IPSSysCss | null {
    if (this.pssyscss != null) return this.pssyscss;
    const value = this.M.getPSSysCss;
    if (value == null) {
      return null;
    }
    this.pssyscss = this.getPSModel4('res.IPSSysCss', value, 'getPSSysCss') as IPSSysCss;
    return this.pssyscss;
  }

  get psSysCss(): IPSSysCss | null {
    return this.getPSSysCss();
  }

  getPSSysCssMust(): IPSSysCss {
    const value = this.getPSSysCss();
    if (value == null) {
      throw new Error('未指定系统界面样式表');
    }
    return value;
  }

  protected pssysimage: IPSSysImage | null = null;

  getPSSysImage(): IPSSysImage | null {
    if (this.pssysimage != null) return this.pssysimage;
    const value = this.M.getPSSysImage;
    if (value == null) {
      return null;
    }
    this.pssysimage = this.getPSModel4('res.IPSSysImage', value, 'getPSSysImage') as IPSSysImage;
    return this.pssysimage;
  }

  get psSysImage(): IPSSysImage | null {
    return this.getPSSysImage();
  }

  getPSSysImageMust(): IPSSysImage {
    const value = this.getPSSysImage();
    if (value == null) {
      throw new Error('未指定系统图片');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get ungroup(): boolean {
    return this.M.ungroup;
  }

  get cls(): string {
    return 'PSAppPortletCatImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelSortable' || cls == 'app.control.IPSAppPortletCat' || cls == 'res.IPSSysPortletCat') return true;
    return super.instanceof(cls);
  }
}
